<template>
	<card-box title="待审批的新课题" goto="/principal/project/list">
		<el-table :data="tableData" size="medium" height="410px" class="index_table_wrapper">
			<el-table-column type="index" label="序号" width="64"></el-table-column>
			<el-table-column prop="filed1" label="编号" width="120"></el-table-column>
			<el-table-column prop="name" label="课题名称">
				<template slot-scope="{ row }">
					<template v-if="$isHasAuth(['ad3ec74b104c491184d3f7f16c948178'])">
						<router-link class="link" :to="{ path: '/principal/project/detail', query: { id: row.id } }">{{ row.name }}</router-link>
					</template>
					<template v-else>
						<span class="link">{{ row.name }}</span>
					</template>
				</template>
			</el-table-column>
			<el-table-column label="操作" width="60" v-if="$isHasAuth(['0b1475564d1c4bcfa5a7017432b5c7ac'])">
				<template slot-scope="{ row }">
					<el-button type="text" @click="handleAuditData(row.id)">审核</el-button>
				</template>
			</el-table-column>
		</el-table>
	</card-box>
</template>

<script>
import mixins from './mixins';
import cardBox from '@/views/common/cardBox';
import { queryAuditPageList } from '@/api/business/tbTopic';
export default {
	mixins: [mixins],
	components: { cardBox },
	data() {
		return {
			tableData: []
		};
	},
	mounted() {
		this.getAuditListData();
	},
	methods: {
		async getAuditListData() {
			let params = { page: 1, limit: 8, audit: '3' };
			let result = await queryAuditPageList(params).then((res) => res.data);
			if (result.code === '0') {
				this.tableData = result.data || [];
			}
		},

		handleAuditData(id) {
			this.$router.push({ path: `/principal/project/audit`, query: { id } });
		}
	}
};
</script>

<style scoped></style>
